<?php
/**
 * ClassName:货代处理器
 * @auditor leijunxiang
 * @time 2025/4/1 14:34
 */

namespace app\modelOperate\freightForward;

use app\modelOperate\ModelOpeBase;
use think\facade\Log;

class FreightForwardOpe extends ModelOpeBase
{
    protected $pk = 'forwardId';

    /**
     * 保存数据
     * @param $data
     * @return void
     */
    public function saveData($data)
    {
        $db = $this->getDb();
        $flag = $db->insert($data);
        return $flag;
    }

    /**
     * 查询数据
     * @return mixed
     */
    public function selectData()
    {
        $db = $this->getDb();
        $data = $db->select();
        return $data;
    }

    /**
     * 更新数据
     * @param $data
     * @return mixed
     */
    public function updateForward($forwardId, $name)
    {
        $data = [
            'name' => $name
        ];
        Log::info($data);
        $db = $this->getDb();
        $flag = $db
            ->where($this->pk, $forwardId)
            ->update($data);
        return $flag;
    }

    /**
     * 删除
     */
    public function deleteForward($forwardId)
    {
        $db = $this->getDb();
        $flag = $db->where($this->pk, $forwardId)->delete();
        return $flag;
    }

}